package practice.library.webmagic.persistence.cassandra.model

import java.util.UUID

import com.datastax.driver.core.Row
import com.websudos.phantom.dsl.{CassandraTable, PartitionKey, RootConnector, StringColumn, UUIDColumn}
import practice.library.webmagic.persistence.cassandra.entity.PrePersistedHtmlEntity

/**
  * Created by lovepocky on 16/6/20.
  */
class PrePersistedHtmlModel extends CassandraTable[ConcretePrePersistedHtmlModel, PrePersistedHtmlEntity] {
  override def tableName: String = "page"

  override def fromRow(r: Row): PrePersistedHtmlEntity = PrePersistedHtmlEntity(id(r), url(r), html(r))

  object id extends UUIDColumn(this) with PartitionKey[UUID]

  object url extends StringColumn(this)

  object html extends StringColumn(this)



}

abstract class ConcretePrePersistedHtmlModel extends PrePersistedHtmlModel with RootConnector {

}


